package com.lanou3g.myapplication.activity.singleton.activity;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import com.lanou3g.myapplication.DayNightMode;
import com.lanou3g.myapplication.adapter.RecommendedAdapter;


/**
 * Created by dllo on 16/1/8.
 */
public abstract class BaseActivity extends AppCompatActivity {
    private RecommendedAdapter adapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        DayNightMode.onActivityCreateSetTheme(this);

        setContentView(setLayout());
        ListActivity.addActivity(this);
        initView();
        initData();
    }

    protected abstract int setLayout();

    protected abstract void initView();

    protected abstract void initData();

    public static void nightDate() {
        int theme = DayNightMode.getDayNightMode(LessonApplication.getContext());


        if (theme == DayNightMode.THEME_SUN) {
            DayNightMode.setDayNightMode(LessonApplication.getContext(), DayNightMode.THEME_NIGHT);
        } else {
            DayNightMode.setDayNightMode(LessonApplication.getContext(), DayNightMode.THEME_SUN);
        }
       // finis
//        finish();
//        startActivity(new Intent(LessonApplication.getContext(), LessonApplication.getContext().getClass()));
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        ListActivity.removeActivity(this);
    }
}
